package bjut.core.aop;

import org.aopalliance.aop.Advice;

/**
 * @Author: zhuzhiming
 * @Date: 2022/6/28 13:23
 */
public class AspectJExpressionPointcutAdvisor implements PointcutAdvisor{

    //切面
    private AspectJExpressionPointcut pointcut;

    // 具体的拦截方法   拦截器也是advice
    private Advice advice;

    private String expression;

    public void setExpression(String expression){
        this.expression = expression;
    }

    @Override
    public Advice getAdvice() {
        return this.advice;
    }

    public void setAdvice(Advice advice){
        this.advice = advice;
    }

    @Override
    public Pointcut getPointcut() {
        if(null == pointcut){
            pointcut = new AspectJExpressionPointcut(this.expression);
        }
        return this.pointcut;
    }


}
